#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
const int N = 1e5 + 10;
int cnt[N];
bool st[N];
vector<pair<int,int>> v;
int main()
{
	int n, d, k;
	 cin >> n >> d >> k;
	v.adj(n);

	for (int i = 0; i < n; i ++) cin >> v[i].x >> v[i].y;

	sort(v.begin(), v.end());

	for (int i = 0, j = 0; i < n; i ++)
	{
	    int id = v[i].y;
		cnt[id] ++;
		while (v[i].x - v[j].x >= d)
		{
			cnt[v[j].y] --;
			j ++;
		}
		if (cnt[id] >= k) st[id] = true;
	}
	for (int i = 0; i < N; i ++)
		if (st[i])
          cout << i << endl;
	return 0;
}
